public class HashTable {
    public int takeAttendance(int[] records) {
        int n = records.length;
        int[] arr = new int[n + 1];
        for (int i = 0; i < n; i++) {
            arr[records[i]]++;
        }
        for (int i = 0; i < n + 1; i++) {
            if (arr[i] == 0) {
                return i;
            }
        }
        return n;
    }
}
